package com.meritit.config;

public class TestThread extends Thread{

	private Object obj = new Object();
	
	@Override
	public void run() {
		
		synchronized (obj) {
			try {
				obj.wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			
			System.out.println("程序运行。。。");
		}
	}

	private void notifyThread() {
		synchronized (this) {
			System.out.println("阻塞5秒开始唤醒线程！");
			try {
				Thread.sleep(5000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			obj.notify();
		}
	}
	
	public static void main(String[] args) {
		TestThread tt = new TestThread();
		tt.start();
		tt.notifyThread();
	}
	
}
